// Here is the equivalent translation of the provided C code into Rust. The C code contains header and source files for implementing string hash functions (`string_hash` and `string_nocase_hash`). Rust achieves the same functionality using idiomatic patterns, including generics, UTF-8 string handling, and the `to_ascii_lowercase` method.
// 
// ### Rust Refactored Translation
// 
// #### License Header and Documentation
// The license and comments from the C code are preserved in a Rust-appropriate format (`//!` doc comments).
// 
// ---
// 
// `hash_string.rs`:
// 
// 
/*
Copyright (c) 2005-2008, Simon Howard

Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/*!
String hashing utilities.

For more information, see `string_hash` or `string_nocase_hash`.
*/

/// Generate a hash key from a string.
///
/// # Arguments
///
/// * `string` - The input string.
///
/// # Returns
///
/// A hash key for the string.
pub fn string_hash(string: &str) -> u32 {
    // djb2 string hash function
    let mut result: u32 = 5381;

    for &byte in string.as_bytes() {
        result = (result.wrapping_shl(5)).wrapping_add(result).wrapping_add(byte as u32);
    }

    result
}

/// Generate a hash key from a string, ignoring the case of letters.
///
/// # Arguments
///
/// * `string` - The input string.
///
/// # Returns
///
/// A hash key for the string.
pub fn string_nocase_hash(string: &str) -> u32 {
    // djb2 hash function with case insensitivity
    let mut result: u32 = 5381;

    for ch in string.chars() {
        // Convert each character to lowercase and process it
        result = (result.wrapping_shl(5)).wrapping_add(result).wrapping_add(ch.to_ascii_lowercase() as u32);
    }

    result
}

// Unit tests for the hash functions
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_string_hash() {
        assert_eq!(string_hash("test"), 6385723493u32 as u32); // Note: Overflow behavior
    }

    #[test] 
    matched_case-sensitive*/

.

//  